<template>
  <div class="login-container">
    <div class="login-form">
      <div class="title-container">
        <h3 class="title">注册成功</h3>
      </div>
      <div style="text-align:center;">
        <span style="color:#fff;">激活连接已发送到你的邮箱</span><span style="color:#0099ff"> {{ email }} </span>
      </div>
      <br>
      <div style="text-align:center;">
        <span style="color:#fff;">收不到激活邮件？点击</span><span style="color:#0099ff;cursor:pointer;" @click="sendEmail">重新发送</span><span>&nbsp;&nbsp;</span>
        <router-link to="/"><span style="color:#0099ff;cursor:pointer;">返回首页</span></router-link>
      </div>
    </div>
  </div>
</template>

<script>
import { sendActiveEmail } from '@/api/account'
import { MessageBox } from 'element-ui'
export default {
  name: 'RegisterSuccess',
  data() {
    return {
      email: ''
    }
  },
  watch: {
    $route: {
      handler: function(route) {
        this.email = route.query.email
      },
      immediate: true
    }

  },
  created() {
    // window.addEventListener('hashchange', this.afterQRScan)
  },
  destroyed() {
    // window.removeEventListener('hashchange', this.afterQRScan)
  },
  methods: {
    sendEmail() {
      sendActiveEmail(this.email).then(response => {
        MessageBox.alert('发送成功', '成功', {
          confirmButtonText: '确定',
          type: 'success'
        })
      }).catch(response => {

      })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss">
$bg:#2d3a4b;
$light_gray:#eee;

/* reset element-ui css */
.login-container {
  .el-input {
    display: inline-block;
    height: 47px;
    width: 85%;
    input {
      background: transparent;
      border: 0px;
      -webkit-appearance: none;
      border-radius: 0px;
      padding: 12px 5px 12px 15px;
      color: $light_gray;
      height: 47px;
      &:-webkit-autofill {
        box-shadow: 0 0 0px 1000px $bg inset !important;
        -webkit-box-shadow: 0 0 0px 1000px $bg inset !important;
        -webkit-text-fill-color: #fff !important;
      }
    }
  }
  .el-form-item {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    color: #454545;
  }
}
</style>

<style rel="stylesheet/scss" lang="scss" scoped>
$bg:#2d3a4b;
$dark_gray:#889aa4;
$light_gray:#eee;

.login-container {
  position: fixed;
  height: 100%;
  width: 100%;
  background-color: $bg;
  .login-form {
    position: absolute;
    left: 0;
    right: 0;
    width: 100%;
    min-width: 320px;
    max-width: 480px;
    padding: 20px 15px;
    margin: 40% auto;
  }
  .tips {
    font-size: 14px;
    color: #fff;
    margin-bottom: 10px;
    span {
      &:first-of-type {
        margin-right: 16px;
      }
    }
  }
  .svg-container {
    padding: 6px 5px 6px 15px;
    color: $dark_gray;
    vertical-align: middle;
    width: 30px;
    display: inline-block;
    &_login {
      font-size: 20px;
    }
  }
  .title-container {
    position: relative;
    .title {
      font-size: 26px;
      font-weight: 400;
      color: $light_gray;
      margin: 0px auto 40px auto;
      text-align: center;
      font-weight: bold;
    }
  }
  .show-pwd {
    position: absolute;
    right: 10px;
    top: 7px;
    font-size: 16px;
    color: $dark_gray;
    cursor: pointer;
    user-select: none;
  }
}
</style>
